package net.anzix.jhacks.flexclipse.editor;

import java.util.ArrayList;

import net.anzix.jhacks.flexclipse.builder.hyperlinks.MXMLHyperlinkDetector;

import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;

public class MXMLViewerConfiguration extends StructuredTextViewerConfiguration {

	@Override
	public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
		// TODO Auto-generated method stub
		return super.getContentAssistant(sourceViewer);
	}

	@Override
	protected IContentAssistProcessor[] getContentAssistProcessors(
			final ISourceViewer sourceViewer, final  String partitionType) {
		// TODO Auto-generated method stub
		return super.getContentAssistProcessors(sourceViewer, partitionType);
	}

	@Override
	public IQuickAssistAssistant getQuickAssistAssistant(
			final ISourceViewer sourceViewer) {
		// TODO Auto-generated method stub
		return super.getQuickAssistAssistant(sourceViewer);
	}

	@Override
	public IHyperlinkDetector[] getHyperlinkDetectors(final ISourceViewer sourceViewer) {
		final IHyperlinkDetector[] hyperlinkDetectors = super.getHyperlinkDetectors(sourceViewer);
		ArrayList<IHyperlinkDetector> detectors = new ArrayList<IHyperlinkDetector>();
		for(final IHyperlinkDetector  detector : hyperlinkDetectors) {
			detectors.add(detector);
		}
		detectors.add(new MXMLHyperlinkDetector());
		return detectors.toArray(hyperlinkDetectors);
	}

}
